<?php
class DownloadController extends CController {
	
	public function actionIndex() {
		if($this->is_weixin()){
			$this->render ('view');
		}else{
			header("location:http://wq.dl.nicoworks.com/201607/kk_v00602b0060217.apk");
		}
		
		
		
		
	}
	
	
	function is_weixin(){
	    $user_agent = $_SERVER['HTTP_USER_AGENT'];
	    if (strpos($user_agent, 'MicroMessenger') === false) {
	        // 非微信浏览器禁止浏览
	        return false;
	    } else {
	     return true;
	    }
	}
	
}
